<template>
  <div>
    <van-nav-bar
      :z-index="999"
      :fixed="true"
      left-arrow
      @click-left="onClickLeft"
      :placeholder="true"
      title="班型详情"
    />

    <!-- 版型详情 -->
    <div class="banks-details">
      <div class="popping">
        <div>阶段名称</div>
        <div>课时价位</div>
        <div>课时数量</div>
        <div>金额(元)</div>
      </div>
      <div class="popping" v-for="(item, index) in costBreakdown" :key="index">
        <div>{{ item.stageName }}</div>
        <div v-if="item.classPrice == '0'" class="popping-detail">-</div>
        <div v-else class="popping-detail">{{ item.classPrice }}</div>

        <div v-if="item.classNum == '0'" class="popping-detail">-</div>
        <div v-else class="popping-detail">{{ item.classNum }}</div>

        <div v-if="item.priceAll == '0'" class="popping-detail">-</div>
        <div v-else class="popping-detail">{{ item.priceAll }}</div>
      </div>
      <div class="hourTotal">
        <div>总计</div>
        <div>{{ summation }}</div>
      </div>
    </div>
  </div>
</template>

<script>
import { BanksDetaols } from "../../assets/js/api/apply";
export default {
  name: "BanksDetails",
  data() {
    return {
      costBreakdown: [],
      summation: "" //总价
    };
  },
  created() {
    let dsBridge = require("dsbridge");
    dsBridge.call("goBack", "", function() {
      history.go(-1);
    });
    // let obj = {
    //   inscode: this.$route.params.id
    //   // inscode: this.$route.params.lid
    // };
    // console.log(obj);

    BanksDetaols(this.$route.params.id).then(res => {
      // console.log(res.data);
      this.costBreakdown = res.data;
      let number = 0;
      for (let i = 0; i < this.costBreakdown.length; i++) {
        number += Number(this.costBreakdown[i].priceAll);
      }
      this.summation = number;
    });
  },
  methods: {
    onClickLeft() {
      this.$router.go(-1);
    }
  }
};
</script>

<style></style>
